{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.list}</title>{/block}

{block name="pjax_container"}
<div class="hry-content-wrapper">
  <section class="content-header">
    <ol class="breadcrumb">
      <li>财务管理</li>
      <li class="active">公司对账</li>
    </ol>
  </section>
  <section class="content">
    <div class="row">
      <div class="col-md-12">
        <div class="hry-form-wrapper">
          <div class="box-header with-border" style="height:55px;">
            {include file="public/moneyCompanyList_search" /}
          </div>
          <div class="box-body table-responsive">
            <table class="table table-bordered table-hover table-sort">
              <tr>
                <th>账户集</th>
                <th>总金额（元）</th>
                <th>操作</th>
              </tr>
              <tr>
                <td style="vertical-align:middle">认投账户集</td>
                <td style="vertical-align:middle">{:number_format($datas.pay_for_total,2)}</td>
                <td style="vertical-align:middle">
                  <a class="btn-text btn-primary btn-xs" href="{:url('Money/detailforvote')}">查看明细</a>
                </td>
              </tr>
              <tr>
                <td style="vertical-align:middle">手续费账户集</td>
                <td style="vertical-align:middle">{:number_format($datas.total_fee,2)}</td>
                <td style="vertical-align:middle">
                  <a class="btn-text btn-primary btn-xs" href="{:url('Money/detailForCommissionCharge')}">查看明细</a>
                  <button type="button" class="btn-text btn-primary btn-xs" data-toggle="modal" data-target="#extract" >提取</button>
                </td>
              </tr>
              <tr>
                <td style="vertical-align:middle">推广账户集</td>
                <td style="vertical-align:middle">{:number_format($datas.tg_total,2)}</td>
                <td style="vertical-align:middle">
                  <a class="btn-text btn-primary btn-xs" href="{:url('Money/detailForExtend')}">查看明细</a>
                  <button type="button" class="btn-text btn-primary btn-xs" data-toggle="modal" data-target="#recharge" >充值</button>
                  <button type="button" class="btn-text btn-primary btn-xs" data-toggle="modal" data-target="#jiesuan" >结算</button>
                </td>
              </tr>
              <tr>
                <td style="vertical-align:middle">准备金账户集</td>
                <td style="vertical-align:middle">{:number_format($datas.bak_money,2)}</td>
                <td style="vertical-align:middle"></td>
              </tr>
              <tr>
                <td style="vertical-align:middle">用户总余额</td>
                <td style="vertical-align:middle">{:number_format($datas.member_money_total,2)}</td>
                <td style="vertical-align:middle"></td>
              </tr>
              <tr>
                <td style="vertical-align:middle">标准中间账户集</td>
                <td style="vertical-align:middle" id="balance"></td>
                <td style="vertical-align:middle"> <button type="button" class="btn-text btn-primary btn-xs" data-toggle="modal" data-target="#standard" >查看</button>(该列值不计入合计)</td>
              </tr>
              <tr>
                <td style="vertical-align:middle">合计</td>
                <td style="vertical-align:middle">{:number_format($datas.total_all,2)}</td>
                <td style="vertical-align:middle"></td>
              </tr>
            </table>
          </div>
        </div>
      </div>
    </div>
    <!--中间账户集弹出框-->
    <div class="modal fade" id="standard" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">标准中间账户集查看</h4>
          </div>
          <div class="modal-body">
            <div class="form-group">
              <label for="checkPassword" class="control-label">密码:</label>
              <input type="password" class="form-control password" name="password" id="standardPassword" >
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" dataurl="{:url('money/queryAccountInfo')}" class="btn btn-primary" id="confirmStandard">确认</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          </div>
        </div>
      </div>
    </div>
    <!--提取弹出框-->
    <div class="modal fade" id="extract" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="exampleModalLabel">手续费账户集提取</h4>
          </div>
          <div class="modal-body">
              <div class="form-group">
                <label for="checkMoney" class="control-label">提取金额</label>
                <input type="text" class="form-control money" name="checkMoney" id="checkMoney">
              </div>
              <div class="form-group">
                <label for="checkPassword" class="control-label">密码:</label>
                <input type="password" class="form-control password" name="checkPassword" id="checkPassword" >
              </div>
          </div>
          <div class="modal-footer">
            <button type="button" dataurl="{:url('Money/modifyMoney')}" class="btn btn-primary other_money_modify">确认</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          </div>
        </div>
      </div>
    </div>
    <!--充值弹出框-->
    <div class="modal fade" id="recharge" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">推广账户集充值</h4>
          </div>
          <div class="modal-body">
              <div class="form-group">
                <label for="money" class="control-label">充值金额</label>
                <input type="text" class="form-control money" name="money" id="money">
              </div>
              <div class="form-group">
                <label for="password" class="control-label">密码:</label>
                <input type="password" class="form-control password" name="password" id="password">
              </div>
          </div>
          <div class="modal-footer">
            <button type="button" dataurl="{:url('Money/modifyTgMoney')}" class="btn btn-primary other_money_modify">确认</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          </div>
        </div>
      </div>
    </div>

    <!--结算弹出框-->
    <div class="modal fade" id="jiesuan" tabindex="-1" role="dialog">
      <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
            <h4 class="modal-title">推广账户集结算</h4>
          </div>
          <div class="modal-body">
            <div class="form-group">
              <label for="jiesuan_money" class="control-label">结算金额</label>
              <input type="text" class="form-control money" name="jiesuan_money" id="jiesuan_money">
            </div>
            <div class="form-group">
              <label for="jiesuan_password" class="control-label">密码:</label>
              <input type="password" class="form-control password" name="jiesuan_password" id="jiesuan_password">
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" dataurl="{:url('Money/modifyJsMoney')}" class="btn btn-primary other_money_modify">确认</button>
            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          </div>
        </div>
      </div>
    </div>

  </section>

</div>
<style>
</style>
<script type="text/javascript">
    $(function () {
      window.localStorage.setItem('companyUrl', window.location.href)
      $('#extract').on('hide.bs.modal', function (e) {
        $('#checkMoney').val('')
        $('#checkPassword').val('')
        // do something...
      })
      $('#recharge').on('hide.bs.modal', function (e) {
        $('#money').val('')
        $('#password').val('')
        // do something...
      })
      $('#jiesuan').on('hide.bs.modal', function (e) {
        $('#jiesuan_money').val('')
        $('#jiesuan_password').val('')
        // do something...
      })
      $('#standard').on('hide.bs.modal', function (e) {
        $('#standardPassword').val('')
        // do something...
      })
      $('#confirmStandard').click(function () {
        let url = $(this).attr('dataurl')
        var password = $(this).parents('.modal-content').find('.password').val();
        $.ajax({
          url:url,
          type:"POST",
          dataType:"JSON",
          data:{password:password},
          success:function(msg){
            $.amaran({'message':msg.info});
            if(msg.status==1){
              let str = '总额：'+ msg.data.allAmount + ' 冻结额：'+ msg.data.freezeAmount
              $('#balance').append(str)
              $('#standard').modal('hide')
            }

          },
          error:function(res){
            $.amaran({'message': res.statusText});
            $('#standard').modal('hide')
          }
        })
      })
        {if condition=" $rest_login == 1 "}
        restlogin('{$rest_login_info}');   //登录超时
        {/if}
    })
</script>
{/block}